package com.example.medicine.Mapper;


import com.example.medicine.Bean.Team;

import org.apache.ibatis.annotations.*;
import java.util.List;


@Mapper
public interface TeamMapper {

    /**
     * 从Team表中查询全部
     * 团队名称，医生姓名，录入者，编辑者，电话
     * @return
     */
    @Select("select * from [Team]")
    List<Team> getAll();
    @Select("select  teamname from [team]")
    List<String> getTeam();
    @Select("select id from [Team] where teamName=#{teamName}")
    String getid(String teamname);

    /**
     * 向Team表中插入团队名称，医生姓名，电话
     */
    @Insert("insert into [Team](id, doctorName, teamName, tel) values(newid(), #{doctorName}, #{teamName}, #{tel})")
    void insert(Team team);

    /**
     * 更新Team表，根据主键（ID）
     * 团队名称，医生姓名，电话
     * @param team
     */
    @Update("update [Team] set teamName=#{teamName}, doctorName=#{doctorName}, tel=#{tel} where id=#{id}")
    void update(Team team);

    /**
     * 根据id删除Team表中记录
     * @param id
     */
    @Delete("delete from [team] where id=#{id}")
    void deleteById(String id);

    @Select("select * from [Team] where id=#{id}")
    Team getById(String id);
}
